﻿package com.vicentediaz.view.contact
{
    import com.greensock.*;
    import com.greensock.plugins.*;
    import com.vicentediaz.data.*;
    import com.vicentediaz.fonts.*;
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.text.*;

    dynamic public class ContactText extends MovieClip
    {
        public var button:ContactEmailButton;
        public var email:TextField;
        public var textMask:MovieClip;
        public var phone:TextField;

        public function ContactText()
        {
            TweenPlugin.activate([FrameLabelPlugin, FramePlugin]);
            var _loc_1:* = new PFTempestaS();
            var _loc_2:* = new TextFormat(_loc_1.fontName, 8, 16777215);
            this.phone.embedFonts = true;
            this.email.embedFonts = true;
            this.phone.selectable = true;
            this.email.selectable = true;
            this.phone.setTextFormat(_loc_2);
            _loc_2.underline = true;
            this.email.setTextFormat(_loc_2);
            this.email.autoSize = TextFieldAutoSize.LEFT;
            this.email.multiline = false;
            this.phone.text = Config.getInstance().getByValue("PHONE");
            this.email.text = Config.getInstance().getByValue("EMAIL");
            this.button.x = this.email.x + this.email.width + 7;
            this.mask = this.textMask;
            this.textMask.stop();
            this.button.addEventListener(MouseEvent.CLICK, this.onEmailButtonClick, false, 0, true);
            return;
        }// end function

        private function onEmailButtonClick(param1:MouseEvent) : void
        {
            navigateToURL(new URLRequest("mailto:" + this.email.text));
            return;
        }// end function

        public function showText() : void
        {
            TweenMax.to(this.textMask, 0.7, {frameLabel:"end"});
            return;
        }// end function

    }
}
